import { createRouter, createWebHashHistory } from "vue-router";

import Notfound from "@/views/Notfound.vue";
import NoAuth from "@/views/NoAuth.vue";

import Login from "@/views/Login.vue";
import Home from "@/views/Home.vue";

import OrganizationManage from "@/views/organizationManage/OrganizationManage.vue";
import AccountManage from "@/views/acountManage/AccountManage.vue";
import TeamManage from "@/views/teamManage/TeamManage.vue";
import DepartmentManage from "@/views/departmentManage/DepartmentManage.vue";
import ProjectManage from "@/views/projectManage/ProjectManage.vue";

import FunctionAllocation from "@/views/functionAllocation/FunctionAllocation.vue";

import FindPassword from "@/views/FindPassword.vue";

export const menu = [
  {
    path: "/OrganizationManage",
    name: "OrganizationManage",
    component: OrganizationManage,
    meta: { name: "团队管理", icon: "Users", url: "Organization.html?wbt_id=1" }
  },
  {
    path: "/AccountManage",
    name: "AccountManage",
    component: AccountManage,
    meta: { name: "团队管理", icon: "Users", url: "ShouQuan_Goverment_Admin.html?zg_id=1" }
  },
  {
    path: "/TeamManage",
    name: "TeamManage",
    component: TeamManage,
    meta: {
      name: "团队管理",
      icon: "Users",
      url: "TeamManage.html?companyId=076fafd0-cb28-420e-840c-9657bcbfa428"
    }
  },
  {
    path: "/DepartmentManage",
    name: "DepartmentManage",
    component: DepartmentManage,
    meta: {
      name: "团队管理",
      icon: "Users",
      url: "DepartmentManage.html?companyId=076fafd0-cb28-420e-840c-9657bcbfa428"
    }
  },
  {
    path: "/ProjectManage",
    name: "ProjectManage",
    component: ProjectManage,
    meta: {
      name: "团队管理",
      icon: "Users",
      url: "DepartmentManage.html?companyId=076fafd0-cb28-420e-840c-9657bcbfa428&depId=1"
    }
  },
  {
    path: "/FunctionAllocation",
    name: "FunctionAllocation",
    component: FunctionAllocation,
    meta: {
      name: "功能分配",
      icon: "menu",
      url: "FunctionAllocation.html"
    }
  }
];
let router = createRouter({
  history: createWebHashHistory(),
  // history: createWebHistory ("/web/"),
  routes: [
    {
      path: "/",
      name: "home",
      component: Home,
      redirect: "/OrganizationManage",
      meta: {
        name: "中数智算",
        icon: "menu"
      },
      children: menu
    },

    {
      path: "/login",
      name: "Login",
      component: Login,
      meta: { icon: "Users", name: "登陆" }
    },
    {
      path: "/FindPassword",
      name: "FindPassword",
      component: FindPassword,
      meta: { icon: "Users", name: "找回密码" }
    },
    {
      path: "/:otherPage(.*)",
      // alias: ["/:otherPage(.*)"],
      name: "404",
      component: Notfound,
      meta: {
        icon: "coin",
        name: "未知页面"
      }
    },
    {
      path: "/noAuth",
      name: "NoAuth",
      component: NoAuth,
      meta: {
        icon: "coin",
        name: "权限不足"
      }
    }
  ]
});
// router.beforeEach(function (to, from, next) {
//   console.log(to, from, router);
//   next((vm) => {
//     console.log('333',vm);
//   });
// });
export default router;
